package cn.com.open.itembank.service;

import cn.com.open.itembank.dto.CopyCourseModel;
import cn.com.open.itembank.dto.ReturnModel;
import cn.com.open.itembank.entity.CourseItemBank;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by lucky on 2017/9/5.
 */
@FeignClient(name = "item-base-service")
public interface CourseRemoteService {
    /**
     * 根据资源课程id获取可用题库信息.
     *
     * @param courseId 资源课程id
     * @return 可用题库信息
     */
    @GetMapping(value = "/course/{id}")
    CourseItemBank getCourseItemBankInfoByCourseId(@PathVariable(value = "id") String courseId);

    /**
     * 复制课程题库.
     *
     * @param sourceCourseId 源资源课程ID（被共享的课程）
     * @param courseModel    复制课程模型
     * @return the return model
     */
    @PostMapping(value = "/course/{id}/copy")
    ReturnModel copy(@PathVariable(value = "id") String sourceCourseId, @RequestBody CopyCourseModel courseModel);

    /**
     * 判断给定的appkey是否拥有给定的资源id的管理权限
     *
     * @param courseID 资源id
     * @param appKey   appkey
     * @return true ，拥有；false，不拥有
     */
    @GetMapping(value = "/course/{id}/coursepermission")
    boolean coursePermission(@PathVariable(value = "id") String courseID, @RequestParam("appId") String appKey);

    /**
     * Redis 查询题数集合,返回课程和题数
     *
     * @return
     */
    @GetMapping("/course/findcoursequestioncount")
    ReturnModel findCourseQuestionCount();
}
